package com.sptan.ssmp.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sptan.ssmp.domain.AdminUser;
import com.sptan.ssmp.dto.AdminUserCriteria;
import com.sptan.ssmp.dto.AdminUserDTO;
import com.sptan.ssmp.dto.auth.AuthRequest;
import com.sptan.ssmp.dto.auth.AuthResponse;
import com.sptan.framework.core.ResultEntity;


import java.util.Optional;

/**
 * <p>
 * 管理端用户表 服务类.
 * </p>
 *
 * @author lp
 * @since 2024 -05-04
 */
public interface AdminUserService extends IService<AdminUser> {

    /**
     * 保存.
     *
     * @param dto the dto
     * @return the result entity
     */
    ResultEntity<AdminUserDTO> save(AdminUserDTO dto);

    /**
     * 删除.
     *
     * @param id the id
     * @return the result entity
     */
    ResultEntity<Boolean> delete(Long id);

    /**
     * 查看详情.
     *
     * @param id the id
     * @return the result entity
     */
    ResultEntity<AdminUserDTO> detail(Long id);

    /**
     * 根据条件查询.
     *
     * @param criteria the criteria
     * @return the result entity
     */
    ResultEntity<IPage<AdminUserDTO>> search(AdminUserCriteria criteria);

    /**
     * Gets by user name.
     *
     * @param username the username
     * @return the by user name
     */
    Optional<AdminUser> findByUserName(String username);

    /**
     * Register admin user.
     *
     * @param username the username
     * @param password the password
     * @return the admin user
     */
    ResultEntity<AuthResponse> register(String username, String password);

    /**
     * Login result entity.
     *
     * @param request the request
     * @return the result entity
     */
    ResultEntity<AuthResponse> login(AuthRequest request);
}
